package com.zz.common

object ExternalOffsetStore {
  final case class TopicPartitionGroupId(
      topic: String
    , partition: Int
    , groupId: String
  )
  final case class TopicPartitionGroupIdOffset(
      topic: String
    , partition: Int
    , groupId: String
    , offset: Long
    , updatedAt: Long
  ) {
    def topicPartitionGroupId = TopicPartitionGroupId(topic, partition, groupId)
  }
  object TopicPartitionGroupIdOffset {
    def fromTopicPartitionGroupId(t: TopicPartitionGroupId, offset: Long, ts: Long) =
      TopicPartitionGroupIdOffset(
          topic = t.topic
        , partition = t.partition
        , groupId = t.groupId
        , offset = offset
        , updatedAt = ts
      )
  }
  final case class TopicPartitionOffset(
      topic: String
    , partition: Int
    , offset: Long
    , updatedAt: Long
  )
}
